<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        font-size: 0;
      }
      span {
        display: inline-block;
        width: 50px;
        height: 20px;
        border: solid 1px black;
        box-sizing: content-box;
      }
    </style>
  </head>
  <body>
    <script>
      function fn(x, y) {
        var x = parseInt(prompt("请输入需要几行表格"));
        var y = parseInt(prompt("请输入需要几列表格"));

        for (var i = 0; i < x; i++) {
          for (var j = 0; j < y; j++) {
            document.write("<span></span>");
          }
          document.write("<br/>");
        }
      }
      document.write(fn());
    </script>
  </body>
</html>
